package com.yj.controller;

import com.yj.Result.ResponseResult;
import com.yj.service.ActivityService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/app/swiper")
public class SwiperController {
    @Autowired
    private ActivityService activityService;

    /**
     * 轮播图列表
     * swiperList: [
     *   {
     *     url: "https://example.com/image1.jpg", // 图片链接
     *     type: "image" // 类型（如：图片、视频等）
     *   },
     *   {
     *     url: "https://example.com/image2.jpg",
     *     type: "image"
     *   }
     * ]
     * @param requestBody 请求参数
     * @return ResponseResult
     */
    @PostMapping("/swiperList")
    public ResponseResult swiperList(@RequestBody Map<String, Integer> requestBody){
        Integer type = requestBody.get("type");
        try {
            return activityService.swiperList();
        } catch (Exception e) {
            e.printStackTrace();
            return ResponseResult.errorResult(500, "Server Error: " + e.getMessage());
        }
    }


}
